package com.eastone.user.serverapi.dao.impl;

import java.util.Collections;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.eastone.user.serverapi.dao.InfoRoleAuthDao;
import com.eastone.user.serverapi.model.InfoRoleAuth;
import com.yjx.framework.dao.impl.CommonDaoImpl;

@Repository("infoRoleAuthDao")
public class InfoRoleAuthDaoImpl extends CommonDaoImpl<InfoRoleAuth> implements InfoRoleAuthDao {
	@Override
	public List<InfoRoleAuth> getList() {
		List<InfoRoleAuth> resultList = this.getSqlSession().selectList(getStatementPrefix() + ".getList");
		if (resultList == null) {
			resultList = Collections.emptyList();
		}
		return resultList;
	}

	@Override
	public int getCount() {
		Integer result = (Integer) this.getSqlSession().selectOne(getStatementPrefix() + ".getCount");
		return result != null ? result.intValue() : 0;
	}

	@Override
	public List<InfoRoleAuth> getByRoleId(String roleId) {
		return this.getSqlSession().selectList(getStatementPrefix() + ".getByRoleId",roleId);
	}

	@Override
	public InfoRoleAuth getByRoleAndAuthId(InfoRoleAuth infoRoleAuth) {
		return this.getSqlSession().selectOne(getStatementPrefix() + ".getByRoleAndAuthId",infoRoleAuth);
	}
}
